﻿using Mengsk.ProxyDelivery.Domain;
using Mengsk.ProxyDelivery.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace Mengsk.ProxyDelivery.Converters
{
    public class ShoesCommentConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            OrderGoods og = value as OrderGoods;
            if (og == null)
            {
                return "";
            }

            if (((int)og.State) >= (int)OrderState.OutOfStock && ((int)og.State) < (int)OrderState.Shipped && og.NumberId > 0)
            {
                Shoes s = ServiceContainer.GetService<ShoesService>().GetById(og.NumberId);
                if (s != null)
                {
                    return s.Comment;
                }
                return "";
            }
            return "";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
